package org.rc.task;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author dokeeffe
 */
public class TaskManager {
   
    private Map<String, Task> tasks = new HashMap<String,Task>();
    
    /**
     * Constructor
     */
    public TaskManager() {
        addTask(new DeleteRaceAndResultsTask());
        addTask(new ReindexRacesTask());
        addTask(new ReIndexAthletesTask());
        addTask(new UpdateRaceResultCountTask());
        
    }

    /**
     * @return the tasks
     */
    public Map<String, Task> getTasks() {
        return tasks;
    }

    /**
     * 
     * @param name
     * @param parameterMap 
     */
    public void runTask(String name, Map parameterMap) {
        tasks.get(name).run(parameterMap);
    }

    private void addTask(Task task) {
        this.tasks.put(task.getTaskName(), task);
    }
    
}
